package com.abigoni.ciaomondoandroid.blogics.user;

import java.sql.SQLException;

import android.database.Cursor;

public class User{

	public static final String TABLE = "UTENTI";

	private int id;
	private String nome;
	private String cognome;
	private String email;
	private String cdUser;
	private String pwd;

	public User(){}

	public User (Cursor cursor) throws SQLException{

		this.id      = cursor.getInt(cursor.getColumnIndex("ID"));
		this.nome    = cursor.getString(cursor.getColumnIndex("NOME"))    != null ? cursor.getString(cursor.getColumnIndex("NOME"))    : "";
		this.cognome = cursor.getString(cursor.getColumnIndex("COGNOME")) != null ? cursor.getString(cursor.getColumnIndex("COGNOME")) : "";
		this.email   = cursor.getString(cursor.getColumnIndex("EMAIL"))   != null ? cursor.getString(cursor.getColumnIndex("EMAIL"))   : "";
		this.cdUser  = cursor.getString(cursor.getColumnIndex("CD_USER")) != null ? cursor.getString(cursor.getColumnIndex("CD_USER")) : "";
		this.pwd     = cursor.getString(cursor.getColumnIndex("PWD"))     != null ? cursor.getString(cursor.getColumnIndex("PWD"))     : "";
	}

	public User(String nome, String cognome, String email, String cdUser, String pwd){

		this.nome    = nome;
		this.cognome = cognome;
		this.email   = email;
		this.cdUser  = cdUser;
		this.pwd     = pwd;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getCognome() {
		return cognome;
	}

	public void setCognome(String cognome) {
		this.cognome = cognome;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getCdUser() {
		return cdUser;
	}

	public void setCdUser(String cdUser) {
		this.cdUser = cdUser;
	}

	public String getPwd() {
		return pwd;
	}

	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
}